package mainAcessoWSDL;

 
import org.epo.exchange.DocNumberType;
import org.epo.exchange.ExchangeDocuments;
import org.epo.exchange.KindType;
import org.epo.exchange.PublicationReferenceType;
import org.epo.exchange.PublicationReferenceType.DocumentId;
import org.epo.ops.BiblioRetrieval;
import org.epo.ops.WorldPatentData;
import org.epo.ops.wsdl.BiblioRetrievalPortType; 
import org.epo.ops.wsdl.OPSBiblioRetrievalService; 


public class Acesso {   

	
	  
	public static void main(String[] args) {
		
		System.out.println("teste1");
		try {   
			  OPSBiblioRetrievalService service = new OPSBiblioRetrievalService();
			   System.out.println("teste2");
			   System.out.println(service);
	            
	            BiblioRetrievalPortType biblioRetrievePort = service
	                    .getBiblioRetrievalPort();
	            BiblioRetrieval biblioRetrieve = new BiblioRetrieval();
	            biblioRetrieve.setFullPublicationCycle(true);

	            DocNumberType docNumber = new DocNumberType();
	            docNumber.setValue("3071255");
	            //
	            DocumentId documentId = new DocumentId();
	            documentId.setDocNumber(docNumber); 
	            KindType kt = new KindType();
	            kt.setValue("B2");
	            documentId.setKind(kt);
	            documentId.setDocNumber(docNumber);
	            documentId.setCountry("JP");

	            PublicationReferenceType publicationReference = new PublicationReferenceType();
	            publicationReference.setDocumentId(documentId);
	            publicationReference.setDataFormat("docdb");

	            biblioRetrieve
	                    .getPublicationReferenceOrApplicationReferenceOrPriorityClaim()
	                    .add(publicationReference);

	            WorldPatentData patente = biblioRetrievePort
	                    .biblioRetrieval(biblioRetrieve);	          
	            
	            ExchangeDocuments ed = patente.getExchangeDocuments();           
	            System.out.println("Resultado: "
	                    + ed.getExchangeDocument().get(0).getDocNumber());
	        } catch (Exception ex) {
	            ex.printStackTrace();
	        }
	}
	
	
	
}
